<%--                                                                       --%>
<%-- Copyright (c) 2004-2005 BroadVision, Inc.  All rights reserved.       --%>
<%--                                                                       --%>
<%-- This software is copyrighted. Under the copyright laws, this software --%>
<%-- may not be copied, in whole or in part, without prior written consent --%>
<%-- of BroadVision, Inc. or its assignees. This software is provided      --%>
<%-- under the terms of a license between BroadVision and the recipient,   --%>
<%-- and its use is subject to the terms of that license.                  --%>
<%--                                                                       --%>
<%-- This software may be protected by one or more U.S. and International  --%>
<%-- patents.  Certain applications of BroadVision One-To-One software are --%>
<%-- covered by U.S. patent 5,710,887.                                     --%>
<%--                                                                       --%>
<%-- TRADEMARKS: BroadVision and BroadVision One-To-One are registered     --%>
<%-- trademarks of BroadVision, Inc., in the United States and the         --%>
<%-- European Community, and are trademarks of BroadVision, Inc., in other --%>
<%-- countries.  The BroadVision logo, is a trademark of BroadVision,      --%>
<%-- Inc., in the United States and other countries. Additionally, IONA    --%>
<%-- and Orbix are trademarks of IONA Technologies, Ltd.  RSA, MD5, and    --%>
<%-- RC2 are trademarks of RSA Data Security, Inc.                         --%>
<%--                                                                       --%>

<%@ page import="com.broadvision.emarketing.criteriabuilder.*"%>
<%@ page import="org.apache.struts.taglib.TagUtils"%>
<%@ page import="com.broadvision.web.util.DateTime"%>
<%@ page import="com.broadvision.emarketing.criteriabuilder.*"%>

<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/bv-html.tld" prefix="bvhtml" %>

<c:set var="formBean" value="${emDateConditionForm}" />
<c:set var="formBeanMap" value="${formBean.map}" />

<script language="javascript" src="<%=request.getContextPath()%>/mc/js/date.js"></script>

<SCRIPT language='Javascript'>

<c:if test="${formBeanMap.fromBranchNew && not empty formBeanMap.backURL}"> 
    function backToURLPage(theForm) {
      theForm.action = "<c:out value="${formBeanMap.backURL}" />";
      //We don't need validate data here since they will not be used.
      theForm.submit();
      return false;
    }
</c:if>
  function saveCondition(theForm) {
    <c:choose>
      <c:when test="${formBeanMap.fromBranchNew && not empty formBeanMap.backURL}" >
        theForm.action = "<html:rewrite page="/em/cb/profMvBranchConditionUpdate.do" />";
      </c:when>
    </c:choose>
    theForm.submit();
    return false;
  }

function cancelAction(theForm){
	window.location="<html:rewrite page="/em/cb/displayCriteriaBuilder.do"/>";
    return false;
  }

</SCRIPT>


<html:form action="/em/cb/updateSystemDateCondition.do">
  <html:hidden name="emDateConditionForm" property="key" />
  <html:hidden name="emDateConditionForm" property="dataType" />
  <html:hidden name="emDateConditionForm" property="actType" />
  <html:hidden name="emDateConditionForm" property="fromBranchNew" />
  <html:hidden name="emDateConditionForm" property="backURL" />


  <c:set var="pageTitle">
    <c:choose>
      <c:when test='${formBeanMap.actType == "create"}'>
        <bean:message bundle="em" key="em.cb.dateTimeCondition.add" />
      </c:when>
      <c:otherwise>
        <bean:message bundle="em" key="em.cb.dateTimeCondition.edit" />
      </c:otherwise>
    </c:choose>
  </c:set>
  
 <table class="zoneFive" width="100%" border="0" cellspacing="0" cellpadding="0" summary="content area">
  <tr>
    <td valign="top" width="100%">
      <div class="pageTitle"><c:out value="${pageTitle}" /></div>
      <div class="errorMessage"><html:errors/></div>

      <!--end page title area here-->
      
      <div class="pageSubtitle">
        <span class="left"><c:out value="${pageTitle}" />  </span>
        <span class="right">&nbsp;</span>
      </div>

	 <div class="pageInstructions">
            <bean:message bundle="em" key="em.cb.relational.condition.instruction.simple"/>
      </div>

    <!-- Start main content here-->
      <table class="labelForm" width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr>			
				<td class="label" valign="top" width="25%"><bean:message bundle="em"
						key="em.cb.dateTimeCondition.label.selectTheCondition" />:
				</td>
				<td class="label" valign="top" width="73%">
						<bean:define id="operators" name="emDateConditionForm" property="operatorList" type="java.util.Collection" /> 
						<html:select name="emDateConditionForm" property="operator">
						   <html:options collection="operators" property="name" labelProperty="friendlyName" />
						</html:select>
				</td>
		 </tr>
		 <tr>
				<td class="label" width="25%"><bean:message bundle="em"
						key="em.cb.dateTimeCondition.label.selectTheDate" />:
				</td>
				<td class="label" valign="top" width="73%">
					 <bvhtml:date  name="emDateConditionForm" 
                                  property="itemValue"/>
                    		    <a href="JavaScript:datePopup('<html:rewrite page="/mc/calendar.do"/>', 
                                          'emDateConditionForm', 
                                           'itemValue')">
                      			   <html:img page="/mc/images/action/calendar.gif" 
                                     width="22" 
                                     height="22" 
                                     altKey="em.cb.dateTimeCondition.altKey.chooseDate" bundle="em"
                                     border="0" 	
                                     align="absmiddle"/>
                    			</a>
                 </td>
		  </tr>
    </table>
    <div class="pageButtonWrap" align="right">
        <c:if test="${formBeanMap.fromBranchNew && not empty formBeanMap.backURL}" >
          <input type="button" name="backBtn" value="<bean:message bundle="em" key="button.previous" />" class="inputButton" onclick="javascript:return backToURLPage(this.form)" >
        </c:if>
        <input type="button" name="cancelBtn" value="<bean:message bundle="em" key="button.cancel"/>" class="inputButton" onclick="javascript:return cancelAction()">
        <input type="button" name="saveBtn" value="<bean:message bundle="em" key="button.done"/>" class="inputButton" onclick="javascript:return saveCondition(this.form)">
      </div>

    </td>
  </tr>
</table>
</html:form>




















































